package com.bjpowernode.pay.model.param;

import com.bjpowernode.common.pay.PayUtil;
import com.bjpowernode.common.pay.Pkipair;
import lombok.Data;


@Data
public class NotifyParam {
    private String merchantAcctId = "";
    private String version = "";
    private String language = "";
    private String signType = "";
    private String payType = "";
    private String bankId = "";
    private String orderId = "";
    private String orderTime = "";
    private String orderAmount = "";
    private String bindCard= "";
    private String bindMobile="";
    private String dealId = "";
    private String bankDealId = "";
    private String dealTime = "";
    private String payAmount = "";
    private String fee = "";
    private String ext1 = "";
    private String ext2 ="";
    private String payResult = "";
    private String aggregatePay = "";
    private String errCode = "";
    private String signMsg = "";


    //验证签名
    public  boolean checkSign(){
        String merchantSignMsgVal = "";
        merchantSignMsgVal = PayUtil.appendParam(merchantSignMsgVal,"merchantAcctId", merchantAcctId);
        merchantSignMsgVal = PayUtil.appendParam(merchantSignMsgVal, "version",version);
        merchantSignMsgVal = PayUtil.appendParam(merchantSignMsgVal, "language",language);
        merchantSignMsgVal = PayUtil.appendParam(merchantSignMsgVal, "signType",signType);
        merchantSignMsgVal = PayUtil.appendParam(merchantSignMsgVal, "payType",payType);
        merchantSignMsgVal = PayUtil.appendParam(merchantSignMsgVal, "bankId",bankId);
        merchantSignMsgVal = PayUtil.appendParam(merchantSignMsgVal, "orderId",orderId);
        merchantSignMsgVal = PayUtil.appendParam(merchantSignMsgVal, "orderTime",orderTime);
        merchantSignMsgVal = PayUtil.appendParam(merchantSignMsgVal, "orderAmount",orderAmount);
        merchantSignMsgVal = PayUtil.appendParam(merchantSignMsgVal, "bindCard",bindCard);
        merchantSignMsgVal = PayUtil.appendParam(merchantSignMsgVal, "bindMobile",bindMobile);
        merchantSignMsgVal = PayUtil.appendParam(merchantSignMsgVal, "dealId",dealId);
        merchantSignMsgVal = PayUtil.appendParam(merchantSignMsgVal, "bankDealId",bankDealId);
        merchantSignMsgVal = PayUtil.appendParam(merchantSignMsgVal, "dealTime",dealTime);
        merchantSignMsgVal = PayUtil.appendParam(merchantSignMsgVal, "payAmount",payAmount);
        merchantSignMsgVal = PayUtil.appendParam(merchantSignMsgVal, "fee", fee);
        merchantSignMsgVal = PayUtil.appendParam(merchantSignMsgVal, "ext1", ext1);
        merchantSignMsgVal = PayUtil.appendParam(merchantSignMsgVal, "ext2", ext2);
        merchantSignMsgVal = PayUtil.appendParam(merchantSignMsgVal, "payResult",payResult);
        merchantSignMsgVal = PayUtil.appendParam(merchantSignMsgVal, "aggregatePay",aggregatePay);
        merchantSignMsgVal = PayUtil.appendParam(merchantSignMsgVal, "errCode",errCode);

        Pkipair pki = new Pkipair();
        boolean flag = pki.enCodeByCer(merchantSignMsgVal, signMsg);
        return flag;
    }
}
